package com.iafme.dto.res;

import cn.zhxu.bs.bean.DbField;
import cn.zhxu.bs.bean.SearchBean;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * @author summer
 * @version 1.0
 * @date 2025/3/27 11:48
 */
@Data
@SearchBean(tables = "iafme_certificate_info i LEFT JOIN iafme_member m ON i.memberId=m.id LEFT JOIN iafme_certificate c " +
        " ON i.certificateId=c.id ",orderBy = "i.createTime DESC")
public class CertificateInfoResDTO implements Serializable {

    @DbField("i.id")
    private Integer id;

    @DbField("i.certificateId")
    private Integer certificateId;

    @DbField("c.name")
    private String certificateName;

    @DbField("i.memberId")
    private Integer memberId;

    @DbField("m.name")
    private String memberName;

    @DbField("m.igAasId")
    private String igAasId;

    @JsonFormat(pattern = "yyyy-MM-dd")
    @DbField("i.sendingTime")
    private Date sendingTime;

    @JsonFormat(pattern = "yyyy-MM-dd")
    @DbField("i.deadlineTime")
    private Date deadlineTime;

    @DbField("i.isLongTerm")
    private Integer isLongTerm;

    @DbField("CASE WHEN isLongTerm=0 THEN '否' WHEN  isLongTerm=1 THEN '是'  ELSE '-' END")
    private String longTermName;

    @DbField("i.status")
    private Integer status;

    @DbField(" CASE WHEN i.status=0 THEN '在册' WHEN i.status=1 THEN '补办' WHEN i.status=2 THEN '注销' WHEN i.status=3 THEN '过期' ELSE '-' END")
    private String statusName;

    @DbField("i.certificateNo")
    private String certificateNo;
}
